#include<stdio.h>
#include <stdlib.h>

typedef struct Flexible {
    int N;
    int Mat[0];
}Flexible;

int main() {
    int n = 0;
    scanf("%d", &n);
    //创建柔性数组
    Flexible *arr = (Flexible *) malloc(sizeof(Flexible) + n * n * sizeof(int));
    if (arr == NULL) {
        perror("堆区开辟空间失败:");
    }
    arr->N = n * n;
    //柔性数组的使用
    arr->Mat[1] = 0;
    for (int i = 0; i / n < n; i += n) {
        for (int j = 0; j <= (i / n); j++) {
            if (j == 0 || j == (i / n)) {
                arr->Mat[i + j] = 1;
            } else {
                arr->Mat[i + j] = arr->Mat[i + j - n] + arr->Mat[i + j - n - 1];
            }
            printf("%5d", arr->Mat[i + j]);
        }
        printf("\n");
    }

    //释放柔性数组
    free(arr);
    arr = NULL;
    return 0;
}